<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
	<link rel="stylesheet" href="http://localhost/cms_edu/Template/default/css/page.css" />
	<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://localhost/cms_edu/Template/default/css/style.css" />
<script type="text/javascript" src="http://localhost/cms_edu/Template/default/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://localhost/cms_edu/Template/default/js/js.js"></script>
<link rel="stylesheet" type="text/css" href="http://localhost/cms_edu/Static/hdjs/hdjs.css"/>
<script src="http://localhost/cms_edu/Static/hdjs/hdjs.min.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
	$(function(){
		//定义检测用户名是否存在的ajax请求地址
		var checkUser = "<?php echo U('Common/checkUser');?>";
		var checkUserCode = "<?php echo U('Common/checkUserCode');?>";
		$('#regForm').validate({
			username_reg : {
				rule:{
					required:true,
					ajax:{url:checkUser}
				},
				error:{
					required:'用户名必填',
				},
				success:'ok',
				message:'请填写用户名'
			},
			nickname : {
				rule:{
					required:true,
				},
				error:{
					required:'昵称必填',
				},
				success:'ok',
				message:'请填写昵称'
			},
			password_reg1 : {
				rule:{
					required:true,
					minlen:6
				},
				error:{
					required:'密码必填',
					minlen:'密码不得少于6位'
				},
				success:'ok',
				message:'请填写密码'
			},
			password_reg2 : {
				rule:{
					required:true,
					confirm:'password_reg1'
				},
				error:{
					required:'确认密码必填',
					confirm:'两次密码不相同'
				},
				success:'ok',
				message:'请填写密码'
			},
			code : {
				rule:{
					required:true,
					ajax:{url:checkUserCode}
				},
				error:{
					required:'验证码必填',
				},
				success:'ok',
				message:'请填写验证码'
			},
		})
	})
</script>
</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href="http://localhost/cms_edu"><img src="http://localhost/cms_edu/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<?php
	$topCate = K('Category')->where("pid=0")->limit(1000)->all();
	foreach($topCate as $field):
	$field['url'] = getCateUrl($field['is_html'],$field['htmldir'],$field['cid']);
?>
	
					<li>
						<a href="<?php echo $field['url'];?>"><?php echo $field['cname'];?></a>
					</li>
				
<?php
	endforeach;
?>
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			<div id="loginInfo" class='loginInfo'>
				<?php if(!isset($_SESSION['uname'])){ ?>
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
				<a href="javascript:showRegBox();">注册</a>
				<?php }else{ ?>
				<span><?php echo $hd['session']['uname'];?></span><a href="<?php echo U('out');?>">退出</a>
				<?php } ?>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="<?php echo U('login');?>" method="post">
			<div class="login_hide_box">
				<img src="http://localhost/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：</p>
					<input type="text" name="username" class="text" />
					<p>密码：</p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="<?php echo U('reg');?>" method="post">	
			<div class="reg_hide_box">
				<img src="http://localhost/cms_edu/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<span id="hd_username_reg"></span></p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="<?php echo U('code');?>" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			<p><span class="title">最新消息：</span>
				<?php
	//如果有此参数，就是要实现分页效果
	if(0){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("")->count();
		$pageObj = new Page($total,0,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("")->limit(1)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_html'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>
<?php echo $field['title'];?>
<?php
	endforeach
?></p>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
		
		
		
		
		
	
	<!-- 主体区域 -->
	<div id="page_main">
		<!-- 右侧区域 -->
	<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!-- 右侧区域 -->
		<div class="right">
			<div class='hd_title'>
				<strong>标签云</strong>	
			</div>
			<div id="tagBox" class='tags'>
						<?php
			$tagData = K('Tag')->limit(5)->all();
			foreach($tagData as $field):
			$field['url'] = U('List/index',array('tid'=>$field['tid']));
		?>
		
					<a href="<?php echo $field['url'];?>"><?php echo $field['tagname'];?></a>	
				
		<?php
			endforeach;
		?>
			</div>
			<div class='hd_title'>
				<strong>热门文章</strong>	
			</div>
			<ul class='arc_list'>
				<?php
	//如果有此参数，就是要实现分页效果
	if(0){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%热门%'")->count();
		$pageObj = new Page($total,0,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%热门%'")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%热门%'")->limit(2)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_html'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>

					<li>
						<div class='image'>
							<a href="<?php echo $field['url'];?>">
								<img src="<?php echo $field['thumb'];?>" alt=""/>
							</a>
						</div>
						<h2><a href="<?php echo $field['url'];?>"><?php echo $field['title'];?>...</a></h2>
						<p>
							<em><?php echo date('m-d',$field['sendtime']);?></em><span><?php echo $field['total'];?>条评论</span>
						</p>
					</li>
				
<?php
	endforeach
?>	
			</ul>
			<div class='hd_title'>
				<strong>推荐文章</strong>	
			</div>
			
			<ul class='arc_list'>
				<?php
	//如果有此参数，就是要实现分页效果
	if(0){
		//总条数
		$total = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%推荐%'")->count();
		$pageObj = new Page($total,0,5);
		$page = $pageObj->show();
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%推荐%'")->limit($pageObj->limit())->order('sendtime DESC')->all();
	}else{
		$arcData = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where("attr LIKE '%推荐%'")->limit(2)->order('sendtime DESC')->all();
	}
	foreach($arcData as $field):
	//评论总条数
	$field['total'] = K('Comment')->where("article_aid=" . $field['aid'])->count();
	//文章地址
	$field['url'] = getArcUrl($field['is_html'],$field['htmldir'],$field['aid']);
	//文章缩略图
	$field['thumb'] = "http://localhost/cms_edu/" . $field['thumb'];
?>

					<li>
						<div class='image'>
							<a href="<?php echo $field['url'];?>">
								<img src="<?php echo $field['thumb'];?>" alt=""/>
							</a>
						</div>
						<h2><a href="<?php echo $field['url'];?>"><?php echo $field['title'];?>...</a></h2>
						<p>
							<em><?php echo date('m-d',$field['sendtime']);?></em><span><?php echo $field['total'];?>条评论</span>
						</p>
					</li>
				
<?php
	endforeach
?>	
			
			</ul>
		</div>
		<!-- 右侧区域结束 -->
		<!-- 右侧区域结束 -->
		<!-- 左侧 -->
		<div class="left">
			<h1><a href=""><?php echo $c48cms['title'];?></a></h1>
			<!-- 文章信息 -->
			<div class="article_info_box">
				<p class="article_info">
					<span class="padding_right"><?php echo date('m-d H:i:s',$c48cms['sendtime']);?></span>
					分类：<a href="" class="padding_right"><?php echo $c48cms['cname'];?></a>
					<a href="" class="padding_right comment"><?php echo $c48cms['total'];?>条评论</a>
					<span id="click"><?php echo $c48cms['click'];?></span>次浏览
				</p>
			</div>
			<!-- 文章信息结束 -->

			<!-- 文章内容区域 -->
			<div class="article_content">
				<?php echo $c48cms['content'];?>
			</div>
			<!-- 文章内容区域结束 -->

			<p class="position">当前位置：<a href=""><?php echo $c48cms['cname'];?></a> » <a href=""><?php echo $c48cms['title'];?></a></p>
			<p class="tags">
				浏览有关
				<!-- //标签 -->
						<?php
			$tagData = K('Tag')->limit(4)->all();
			foreach($tagData as $field):
			$field['url'] = U('List/index',array('tid'=>$field['tid']));
		?>
		
				<a href="<?php echo $field['url'];?>"><?php echo $field['tagname'];?></a>
				
		<?php
			endforeach;
		?>
				的文章</p>
			<!-- 相关文章 -->
			<ul id="msg_list" class="msg_list">
				<p id="loading">
					<img src="./images/loading.gif" style='width:50px;height:50px;'>
				</p>
				<div>
					评论：
					<ul class="comment-ul">
						
					</ul>
				</div>
			</ul>
			<div id="comment-form-box">
				<form id="commentForm" action="" method="post">	
					<textarea id="comment_content" name="comcon"></textarea>
					<input class='submit' type="submit" value="发表评论">
				</form>
			</div>
		</div>	
	<!-- 主体区域结束 -->
	<!-- 底部区域 -->
	<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!-- 底部浅灰色导航区域 -->
	<div id="bottom_menu_box" style="margin-top:30px;">
		<div class="bottom_menu">
			<?php
	$topCate = K('Flink')->where("is_show=1")->limit(6)->all();
	foreach($topCate as $field):
?>
	
			<dl>
				<dt><a href="<?php echo $field['url'];?>"><?php echo $field['fname'];?></a></dt>
			</dl>
           	
<?php
	endforeach;
?>
		</div>
	</div>
	<!-- 底部浅灰色导航区域结束 -->

	<!-- 底部版权区域 -->
	<div id="bottom_copyright_box">
		<div class="bottom_copyright">
			版权信息
		</div>
	</div>
	<!-- 底部版权区域结束 -->
	
</body>
</html>